package com.yupi.yuaiagent.demo.invoke;

import jakarta.annotation.Resource;
import org.springframework.ai.chat.messages.AssistantMessage;
import org.springframework.ai.chat.model.ChatModel;
import org.springframework.ai.chat.prompt.Prompt;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

//@Component
public class SpringAiInvoke  implements CommandLineRunner {

    @Resource
    @Qualifier("dashscopeChatModel")
    private ChatModel dashscopeApiChatModel;

    @Override
    public void run(String... args) throws Exception {
        AssistantMessage output = dashscopeApiChatModel.call(new Prompt("你好，请简单介绍下自己！")).getResult().getOutput();
        System.out.println("灵积大模型output:" + output.getText());
    }
}
